package edu.neumont.csc380.prime.service;


import javax.xml.bind.annotation.*;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.springframework.stereotype.Service;

import com.sun.xml.bind.v2.runtime.Name;

@XmlRootElement(name = "ProbablePrime")
@XmlAccessorType(XmlAccessType.NONE)
public class ProbablePrime {
	@XmlAttribute(name="Number")
	private int number;
	private Witnesses witnesses;
	@XmlAttribute(name="Confidence")
	private float confidence;
	private String recall;
	
	public ProbablePrime(){
		witnesses = new Witnesses();
	}
	public ProbablePrime(int number, Witnesses witnesses){
		this.number = number;
		this.witnesses = witnesses;
	}
	
	@JsonProperty("Number")
	public int getNumber() {
		return number;
	}
	@JsonIgnore
	public Witnesses getWitnesses(){
		return witnesses;
	}
	@JsonProperty("Confidence")
	public float getConfidence() {
		return confidence;
	}
	
	public void setNumber(int number) {
		this.number = number;
	}
	public void setWitnesses(Witnesses witnesses) {
		this.witnesses = witnesses;
	}
	public void setConfidence(float confidence) {
		this.confidence = confidence;
	}
	
	@Override
	public String toString(){
		String s = "";
		
		s += "Number: " + number + "\n";
		s += "Witnesses: " + witnesses.toString() + "\n";
		s += "Confidence: " + confidence + "\n\n";
		
		return s;
	}
	
	@XmlElement(name="Recall", required = false)
	@JsonProperty("Recall")
	public String getRecall() {
		return recall;
	}
	
	public void setRecall(String recall) {
		this.recall = recall;
	}
	
}
